package muse.widgets;

import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

public abstract class Widget extends JPanel {
	public Widget() {
		super();
		// Testing purposes
		setSize(getPreferredSize());
		add(new JLabel(getClass().getSimpleName()));
	}
	public abstract Dimension getPreferredSize();
	public abstract String getIcon();
	
	@Override
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		// Paint the image, I guess?
		if(getIcon().isEmpty())
			return;
		ImageIcon ii = new ImageIcon(getClass().getClassLoader().getResource(getIcon()));
		g.drawImage(ii.getImage(), 0, 0, null);
	}
}
